<?php

namespace App\Http\Controllers\Home;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use DB;
class ServiceController extends Controller
{
    //会员特权
    public function freedom()
    {
    	return view('home.vip_service.freedom');
    }

    //游戏特权
    public function game()
    {
        //查询热门游戏父类id
        $pdata = DB::table('games') -> where('name' , '热门游戏') -> first();
        $id = $pdata -> id;

        //最新游戏父类id
        $npdata = DB::table('games') -> where('name','最新游戏') -> first();
        $nid = $npdata -> id;
        

        //查询游戏子类数据
        $data = DB::table('games') -> get();

        //获取游戏添加时间
        foreach($data as $k => $v)
        {
            $v -> time = date('Ymd',$v -> time);
        }
        
    	return view('home.vip_service.game',['data' => $data,'id' => $id,'nid' => $nid]);
    }

    //会员等级
    public function level()
    {
    	return view('home.vip_service.level');
    }

       //超级会员
    public function superVip()
    {
        $data = DB::table('tqvip') -> get();
        return view('home.vip_service.supervip',['data' => $data]);
    }

    //年费会员
    public function vipNf()
    {
        $data = DB::table('tqvip') -> get();
        return view('home.vip_service.vipnf',['data' => $data]);
    }
    
}
